package cn.com.connected.controller.open;

import cn.com.connected.base.annotations.Captcha;
import cn.com.connected.controller.BaseController;
import cn.com.connected.dto.SmsDto;
import cn.com.connected.service.SmsService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by sms on 2018/11/18.
 */
@RestController
@Slf4j
public class SmsController extends BaseController {

    @Resource
    private SmsService smsService;

    @Captcha
    @ApiOperation(value="描述:发送验证码 ok")
    @RequestMapping(value="/wx/v1/sms/send",method= RequestMethod.POST)
    public void sendSmsMsg(HttpServletRequest request,@Validated @RequestBody SmsDto smsDto) {
        log.info("短信发送 ip:{} , mac-address:{} , {}",smsDto.getMobile());
        smsService.sendSmsMsg(smsDto);
    }

}
